import excel "C:\Users\sait.cakir\Desktop\premature deindustrialization\data\data expansion\outliers excluded\data up to 2017\10 year averages-negcor overval\overvaluation.xlsx", sheet("Sheet1") firstrow


egen country = group(A)
egen year = group(B)



gen lnplgdpo5ya = ln(plgdpo5ya)
gen lnrgdpch5ya = ln(rgdpch5ya)
 
ipolate lnplgdpo5ya year, gen(lnplgdpo5yanew) epolate by(country)


ipolate lnrgdpch5ya year, gen(lnrgdpch5yanew) epolate by(country)


quietly tab year, gen(year)

regress lnplgdpo5yanew lnrgdpch5yanew year2-year12
regress lnplgdpo5yanew lnrgdpch5yanew year2-year12, robust


predict lnrerhat, xb

gen lnovererval= lnplgdpo5yanew-lnrerhat





//lnunderval

gen plgdpo5ya_inv= 1/plgdpo5ya
gen lnplgdpo5ya_inv= ln(plgdpo5ya_inv)
ipolate lnplgdpo5ya_inv year, gen(lnplgdpo5ya_invnew) epolate by(country)


gen lnrgdpch5ya = ln(rgdpch5ya)
ipolate lnrgdpch5ya year, gen(lnrgdpch5yanew) epolate by(country)


quietly tab year, gen(year)

regress lnplgdpo5ya_invnew lnrgdpch5yanew year2-year12

predict lnrer_hat, xb

gen lnunderval= lnplgdpo5ya_invnew - lnrer_hat
